@extends('backend.template.bootstrap')
@section('content')
<div class="m-b-md">
	<h3 class="m-b-none">反馈管理（{{ $feedbacks->count() }}）</h3>
</div>
<div class="row">
	<div class="col-lg-12">
		<ul class="breadcrumb">
			<li><a href="{{ url('backend') }}"><i class="fa fa-home"></i> 首页</a></li>
			<li class="active">反馈管理</li>
		</ul>
	</div>
</div>
<div class="panel panel-default">
	<header class="panel-heading">所有反馈</header>
	<div class="panel panel-body">
		<div class="panel-heading">
		</div>
		<table class="table table-striped b-t b-light table-middle">
			<thead>
				<tr>
					<th colspan="2">用户</th>
					<th>书籍</th>
					<th>章节</th>
					<th>反馈内容</th>
					<th>时间</th>
					<th>状态</th>
					<th>OP</th>
				</tr>
			</thead>
			<tbody>
				@foreach($feedbacks as $feedback)
				<tr>
					<td width="50"><img src="{{ $feedback->member->avatarUrl() }}" width="50"></td>
					<td width="50">{{ $feedback->member->nickname }}</td>
					<td>{{ $feedback->book->name }}</td>
					<td>{{ $feedback->section->name }}</td>
					<td>{{ $feedback->content }}</td>
					<td>{{ $feedback->created_at->format('Y-m-d h:i:s') }}</td>
					<td>{{ $feedback->status_ex() }}</td>
					<td>
						@if($feedback->isPending())
						{!! Form::open(array('method' => 'POST', 'url' => '/backend/feedbacks/'.$feedback->id.'/finished', 'class' => 'inline')) !!}
						<a href="#"  class="btn btn-sm btn-primary" onclick="if(confirm('确定该反馈问题已解决？')){$(this).parent('form').submit();}">已解决</a>
						{!! Form::close() !!} 
						@endif
						{!! Form::open(array('method' => 'DELETE', 'route' => array('feedbacks.destroy', $feedback->id), 'class' => 'inline')) !!}
							<a class="btn btn-sm btn-danger" href="#" onclick="if(confirm('确定删除吗？')){$(this).parent('form').submit();}">删除</a>
						{!! Form::close() !!} 
					</td>
				</tr>
				@endforeach
			</tbody>
		</table>
	</div>
</div>
@endsection